package yl.hs.bmipfull.utils.datastate;

/*
 * UserState
 * @category
 * @author 谢景广
 * @date 2021-05-18
 */
public enum UserState {
    /**
     * 账户已删除
     */
    Deleted((short) -1),
    /**
     * 账户未启用
     */
    Disable((short) 0),
    /**
     * 账户已过期
     */
    Expired((short) 4),
    /**
     * 账户已启用并且正常
     */
    Enabled((short) 1),
    /**
     * 账户已经锁定，（密码输入错误5次后锁定账户）
     */
    Locked((short) 5);

    private short code;

    UserState(short code) {
        this.code = code;
    }

    public static UserState parseState(short state) {
        for (UserState e : UserState.values()) {
            if (e.code == state)
                return e;
        }
        return UserState.Disable;
    }
}
